package main

import (
	"log"
	"bufio"
	"os"
	"fmt"
	"bytes"
	"encoding/base64"
)

const(
	COUNT = 1500*10
)
  var def = []byte{0x00, 0x00, 0x00}


func main() {
	isf := "/home/wxdl/Downloads/slamtv60.264"

	// 打开文件，创建buffered reader
	file, err := os.Open(isf)
	if err != nil {
		log.Fatal(err)
	}
	defer file.Close()
	bufferedReader := bufio.NewReader(file)
	buf := make([]byte, COUNT)
	 bufferedReader.Read(buf)
	//var lastPacket []byte


        fmt.Println("=======================================%d",len(def))
		packets := bytes.Split(buf, def)
		for k, v := range packets {
			fmt.Printf("index:%d,   length:%d,***** %2x\n", k, len(v),v[:2])
			if(len(v)<200){
				fmt.Printf("%s\n",string(v))
				dst:=make([]byte,100)
				base64.StdEncoding.Decode(dst,v)
				fmt.Printf("%s\n",string(dst))
			}
		}
		//lastPacket = packets[len(packets)-1]
 		//n,_= bufferedReader.Read(buf)

}
